#include <bits/stdc++.h>
using namespace std;
const int MAX_SIZE = 10;
/*
input:
5 5
0 0 0 0 0
1 2 3 4 5
output:
true
input:
5 5
0 0 1 0 0
1 2 3 4 5
output:
false
*/
bool isGoodPlan(int *status, int statusLen, int *plan, int planLen)
{
    bool res = true;
    int clean = 0;
    // for (int i = 0; i < statusLen; i++)
    //     cout << status[i] << endl;
    for (int i = 0; i < planLen; i++)
    {
        if (plan[i] != 0)
            status[plan[i] - 1]++;
        else
            clean++;
    }
    for (int i = 0; i < statusLen; i++)
    {
        if (status[i] > 1 && clean > 0)
            clean--;
        else if (status[i] > 1 && clean == 0)
        {
            res = false;
            break;
        }
    }
    return res;
}
int main()
{
    freopen("file.in", "r", stdin);
    int n, k;
    // status: 1表示某仓库开始时满仓；0表示空仓
    // plan: 配送计划; plan[i]>0 表示第i天回往仓库plan[i]配送货物
    int status[MAX_SIZE],plan[MAX_SIZE];
    cin >> n >> k;
    for (int i = 0; i < n; i++)
        cin >> status[i];
    for (int i = 0; i < k; i++)
        cin >> plan[i];

    if (isGoodPlan(status, n, plan, k))
        cout << "true";
    else
        cout << "false";
    
    return 0;
}